package process_control;

import java.util.Scanner;

public class P2_task {
    public static void main(String[] args) {
        /**
         * 可输入多个数字  输入非数字结束 计算平均值
         */

        double sum = 0;
        int num_n = 0;

        // for循环判断输入内容
        System.out.println("please Input: ");
        Scanner scn = new Scanner(System.in);
        while (scn.hasNextDouble()){
            double x = scn.nextDouble();
            num_n ++;
            sum += x;
            System.out.println("Continue OR Input other exit: ");
        }

        System.out.println(num_n + "个数字的和是：" + sum);
        System.out.println(num_n + "个数字的平均值是：" + sum/num_n);

    }
}
